import functools
import math
class Solution(object):
    def singleNumber(self, nums):
        """
        :type nums: List[int]
        :rtype: List[int]
        """
        n = len(nums)
        z = functools.reduce(lambda x, y: x ^ y, nums)
        t = int(math.log2(z - (z & (z - 1))))
        t1 = z
        t2 = z
        for i in range(n):
            if (nums[i] >> t) & 1 == 0:
                t1 = t1 ^ nums[i]
            else:
                t2 = t2 ^ nums[i]
        return [t1, t2]




data = Solution()
nums = [1, 2, 1, 3, 2, 5]
print(data.singleNumber(nums))
